package com.linhh.mall.center.web.controller;

import com.linhh.mall.center.api.TbLandAttachmentService;
import com.linhh.mall.center.common.pojo.TbLandAttachment;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Author linhh
 * @Date 2023 03 20 14 22
 **/
@RestController
@RequestMapping("/api/Attachment")
public class TbLandAttachmentController {

    @Reference
    private TbLandAttachmentService tbLandAttachmentService;

    @GetMapping("/all")
    public List<TbLandAttachment> getLandAttachmentAll(){
       return tbLandAttachmentService.selectAll();
    }

    @DeleteMapping("/delete/{id}")
    public int deleteLandAttachment(@PathVariable Long id){
        return tbLandAttachmentService.deleteTbLandAttachment(id);
    }
    @PostMapping("/add")
    public int addLandAttachment(@RequestBody TbLandAttachment tbLandAttachment){
        return tbLandAttachmentService.addTbLandAttachment(tbLandAttachment);
    }

    @PutMapping("/update")
    public int updateLandAttachment(@RequestBody TbLandAttachment tbLandAttachment){
        return tbLandAttachmentService.updateTbLandAttachment(tbLandAttachment);
    }

    @GetMapping("/findByLandId/{landId}")
    public TbLandAttachment getLandAttachmentByLandId(@PathVariable Long landId){
        return tbLandAttachmentService.selectAttachmentByLandId(landId);
    }
}
